#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include"myline.h"
#include<QPainter>
#include<QPainterPath>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    MyLine myline;
    QVector<QLineF> lines;

protected:
        void mousePressEvent(QMouseEvent *event);
        void mouseMoveEvent(QMouseEvent *event);
        void mouseReleaseEvent(QMouseEvent *event);
        void paintEvent(QPaintEvent *);

private slots:
        void on_pushButton_clicked();

        void on_pushButton_2_clicked();

        void on_pushButton_3_clicked();

        void on_pushButton_4_clicked();

        void on_clear_clicked();

        void on_RItem_clicked();

        void on_VItem_clicked();

        void on_Switch_clicked();

        void on_AItem_clicked();

private:
    Ui::MainWindow *ui;

    bool isDrawing = false;
    bool isClear = false;

    bool isLineDrawing = false;     //线  选
    bool isLightDrawing = false;    //灯  选
    bool isOn_OffDrawing = false;   //电源 选
    bool isRDrawing = false;        //电阻 选
    bool isVDrawing = false;        //电压表 选
    bool isSwitch = false;          //开关 选
    bool isADrawing = false;        //电流表 选
    QPointF lastpt,curpt;

    QPainterPath m_Lpath;           //灯泡
    QPainterPath m_On_Off;          //电源
    QPainterPath m_R;               //电阻
    QPainterPath m_V;               //电压表
    QPainterPath m_Switch;          //开关
    QPainterPath m_A;               //电流表

    QPixmap pix;    //全局
    QPixmap tempPix;    //临时画布
};
#endif // MAINWINDOW_H
